# $Id$
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=gst-plugins-good
pkgver=1.12.3
pkgrel=1
pkgdesc="GStreamer Multimedia Framework Good Plugins"
url="https://gstreamer.freedesktop.org/"
arch=(i686 x86_64)
license=(LGPL)
depends=(libpulse jack libsoup gst-plugins-base-libs wavpack aalib taglib libdv libshout libvpx
         gdk-pixbuf2 libcaca libavc1394 libiec61883 libxdamage v4l-utils cairo libgudev speex flac
         libraw1394)
makedepends=(python gtk-doc autoconf-archive git)
checkdepends=(gst-plugins-base)
_commit=4ce0249911fb4dda1a7e643a91490a10f2a6d415  # tags/1.12.3^0
source=("git+https://anongit.freedesktop.org/git/gstreamer/gst-plugins-good#commit=$_commit"
        "gst-common::git+https://anongit.freedesktop.org/git/gstreamer/common"
        0001-tests-souphttpsrc-Update-test-cert.pem.patch
        0002-tests-souphttpsrc-Make-ssl_cert-key_file-static.patch
        0003-tests-souphttpsrc-Avoid-deprecated-server-ssl-proper.patch
        0004-tests-souphttpsrc-Avoid-deprecated-ssl-ca-file-prope.patch)
sha256sums=('SKIP'
            'SKIP'
            'c8ebf17293c7c2a623cc40339b5619d3496e49a41229780f113ea84ce83c1e60'
            'a1ff7f89a23f84ee0b407f61c32421d875e2a04b06d6d493d1e5e25f3d6e569a'
            '77df36fcf0760f2bda577887ad0b2908900320d4a4f65f002cb8d8452e060d1d'
            'befe8bab743a80e5a5a8d1e3e7b6908405f7d6dce471a6d1dace243986d72428')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname

  # https://bugzilla.gnome.org/show_bug.cgi?id=784005
  patch -Np1 -i ../0001-tests-souphttpsrc-Update-test-cert.pem.patch
  patch -Np1 -i ../0002-tests-souphttpsrc-Make-ssl_cert-key_file-static.patch
  patch -Np1 -i ../0003-tests-souphttpsrc-Avoid-deprecated-server-ssl-proper.patch
  patch -Np1 -i ../0004-tests-souphttpsrc-Avoid-deprecated-ssl-ca-file-prope.patch

  git submodule init
  git config --local submodule.common.url "$srcdir/gst-common"
  git submodule update

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  cd $pkgname

  ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --libexecdir=/usr/lib \
    --with-package-name="GStreamer Good Plugins (Arch Linux)" \
    --with-package-origin="https://www.archlinux.org/" \
    --enable-experimental --enable-gtk-doc --disable-static

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}
